<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="./template.xhtml">

    <ui:define name="title">
        DataTable - <span class="subitem">Row Grouping</span> <span class="blue">- since v6.0.11</span>
    </ui:define>

    <ui:define name="description">
        Rows can be grouped in two ways, using rowGroup component or with groupRow attribute on a column.
    </ui:define>

    <ui:param name="documentationLink" value="/components/datatable" />
    
    <ui:define name="implementation">
        <h3 class="first">Header Row</h3>
        <h:form>
            <p:dataTable var="car" value="#{dtRowGroupView.cars}" sortBy="#{car.brand}" expandableRowGroups="true">
                <p:headerRow>
                    <p:column colspan="3">
                        <h:outputText value="#{car.brand}" />
                    </p:column>
                </p:headerRow>
                <p:column headerText="Year">
                    <h:outputText value="#{car.year}" />
                </p:column>
                <p:column headerText="Color">
                    <h:outputText value="#{car.color}" />
                </p:column>
                <p:column headerText="Id">
                    <h:outputText value="#{car.id}" />
                </p:column>
                <p:summaryRow>
                    <p:column colspan="2" style="text-align:right">
                        <h:outputText value="Total:" />
                    </p:column>
                    <p:column>
                        <h:outputText value="#{dtRowGroupView.randomPrice}">
                            <f:convertNumber type="currency" currencySymbol="$" />
                        </h:outputText>
                    </p:column>
                </p:summaryRow>
            </p:dataTable>
        </h:form>
        
        <h3>Rowspan</h3>
        <h:form>
            <p:dataTable var="car" value="#{dtRowGroupView.cars}" sortBy="#{car.brand}">
                <p:column headerText="Brand" groupRow="true">
                    <h:outputText value="#{car.brand}" />
                </p:column>
                <p:column headerText="Year">
                    <h:outputText value="#{car.year}" />
                </p:column>
                <p:column headerText="Color">
                    <h:outputText value="#{car.color}" />
                </p:column>
                <p:column headerText="Id">
                    <h:outputText value="#{car.id}" />
                </p:column>
            </p:dataTable>
        </h:form>
        
    </ui:define>

</ui:composition>